<extend name="base/Base" />
<block name="Style">
<!-- FooTable Plugin CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/vendor/plugins/footable/css/footable.core.min.css">
		<!-- Admin Forms CSS -->
		<link rel="stylesheet" type="text/css" href="__ABSOLUTEADMIN__/assets/admin-tools/admin-forms/css/admin-forms.css">
	
		<js href="__ADDON__/ueditor/js/jquery-1.11.0.min.js" />
		<js href="__ADDON__/ueditor/cms.admin.config.js" />    
		<js href="__ADDON__/ueditor/ueditor.all.min.js" />
		<script>
		$(function(){
			var url="__APP__/Home/Ueditor/Index/Addon/Ueditor.html";
			var ue = UE.getEditor('container',{
				serverUrl :url,
				UEDITOR_HOME_URL:'__ADDON__/ueditor/',
			});
			

			ue.ready(function(){
				ue.execCommand('serverparam', {
					'uid': "<?php echo getUID(); ?>",
				   'username': '<?php echo getUID(); ?>',
				});
			});

		})
		</script>
</block>
<block name="Topbar">
								
   <header id="topbar" class="ph10">
        <div class="topbar-left">
          <ul class="nav nav-list nav-list-topbar pull-left">
           
			<li   >
              <a href="__APP__/Research/Form/Create.html"    >新增调研</a>
            </li>
			<li    >
              <a  href="__APP__/Research/Form/Manage.html"   >调研大厅</a>
            </li>
           <li class="active"   >
              <a  href="__APP__/Research/Detail/Manage/id/{$id}.html"   >编辑调研</a>
            </li>
          </ul>
        </div>
		<div class="topbar-right hidden-xs hidden-sm">
		<!--  <a href="#"  onclick="selectAll()" class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star pr5"></span>全选</a>
			 <a href="#"   onclick="unSelect()"  class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star-o pr5"></span>不选</a>
			 <a href="#"    onclick="reverse()"class="btn btn-default btn-sm fw600 ml10">
            <span class="fa fa-star-half-o pr5"></span>反选</a>
			  
			
			
			  <a href="#" onclick="status(1)" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-play pr5"></span>启用</a>
			  <a href="#" onclick="status(2)" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-pause pr5"></span>停用</a>
			<a href="#" onclick="status(3)" class="btn btn-default btn-sm fw600 ml10">
				<span class="fa fa-lock pr5"></span>密码</a>
			
			 
				 -->		  
          
        </div>
	</header>
	
	<div class="modal fade" id="usermyModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
									  <div class="modal-dialog" role="document">
										<div class="modal-content">
										  <div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
											<h4 class="modal-title" id="myModalLabel">关系管理</h4>
										  </div>
										  <div class="modal-body">
											<div class="form-group">
												<label for="exampleInputEmail1">请输入用户UID</label>
												<input type="text" name="r_uid" id="r_uid" class="form-control"  placeholder="请输入用户UID">
											  </div>
											  
										
											<div class="form-group">
												<label for="exampleInputEmail1">请输入操作类型</label>
												<br>
												<label class="radio-inline">
												  <input type="radio" checked name="r_type" id="r_type" value="1"> 增加关联
												</label>
												<label class="radio-inline">
												  <input type="radio" name="r_type" id="r_type" value="2"> 删除关联
												</label>
												
												
											  </div>
											  
											  <div class="form-group">
												<label for="exampleInputEmail1">请输入选择群组</label>
												<select class="form-control" id="r_group" name="r_group">
												 <volist name="group" id="group">
												  <option value="{$group.id}">
												  
												    <if condition="$group.type eq 1"> 
													<span style="color:blue;">后台群组</a>
													<else /> 
													<span style="color:green;">独立群组</a>
													</if>
													
													- {$group.name}
												  </option>
												 </volist>
												</select>
												
												
											  </div>
											  
											
											
														
														
														
													
												
																
						
										  </div>
										  <div class="modal-footer">
											<button type="button" class="btn btn-default" data-dismiss="modal">关闭页面</button>
											<a href="#" class="btn btn-primary" onclick="relevance()" >确认操作</a>
															<script>
						
							
							function relevance(){  
								var uid = $("#r_uid").val();
								var group = $("#r_group").val();
								var type = $("input[name='r_type']:checked").val();;
							
								if(uid==''){
								
									layer.msg('请输入用户UID');
								
								}else{
								
									
									$.ajax({
										type:'POST',
										url:"__APP__/Admin/User/Relevance.html",
										data:{
											"uid": uid,
											"type": type,
											"group": group,
										
										},
										success:function(data){			
											var info = eval(data)
											if (info.errcode == 0) {
											
												layer.msg(info.errmsg);
												setTimeout(window.location.reload(),3000);
												
											}else{
												layer.msg(info.errmsg);
											}
										},
								
									});	
								
								}
								
								
								 
							}  
							</script>
										  </div>
										</div>
									  </div>
									</div>
	
				
</block>
<block name="Content">
	<!-- begin: .tray-center -->
        <div class="tray tray-center">

						
         	<script>
						
					function notice(msg){  
						layer.msg(msg);
					}	
							
							
							</script>
          <!-- recent orders table -->
          <div class="panel">
            
            
              <div class="table-responsive">
			  <div class="panel panel-default">
  <div class="panel-heading">{$data.name}</div>
  
  <div class="panel-body">
  {$data.value}
  <hr>
   <js href="__ADDON__/ajaxupload/js/jquery.js" />
		<js href="__ADDON__/ajaxupload/js/ajaxupload.js" />
		
		<volist name="file_list" id="file_list">
	  
		 <script type="text/javascript">
		$(function(){
			var button = $('#upload_button_{$file_list.id}'), interval;
			var confirmdiv = $('#uploadphotoconfirm_{$file_list.id}');
			var fileType = "pic",fileNum = "one"; 
			new AjaxUpload(button,{
				action: "__APP__/Home/Upload/Image/Addon/AjaxUpload.html",
				name: 'userfile',
				onSubmit : function(file, ext){
					if(fileType == "pic")
					{
						if (ext && /^(jpg|png|jpeg|gif|JPG)$/.test(ext)){
							this.setData({
								'info': '文件类型为图片'
							});
						} else {
							 confirmdiv.text('文件格式错误，请上传格式为.png .jpg .jpeg 的图片');
							return false;               
						}
					}
								
					confirmdiv.text('文件上传中');
					
					if(fileNum == 'one')
						this.disable();
					
					interval = window.setInterval(function(){
						var text = confirmdiv.text();
						if (text.length < 14){
							confirmdiv.text(text + '.');                    
						} else {
							confirmdiv.text('文件上传中');             
						}
					}, 200);
				},
				onComplete: function(file, response){
					if(response != "success"){
						if(response =='2'){
							confirmdiv.text("文件格式错误，请上传格式为.png .jpg .jpeg 的图片");
						}else{
							
							confirmdiv.text("上传完成");
							
							$("#newbikephotoName_{$file_list.id}").val(response);
							$("#newbikephoto_{$file_list.id}").attr("src",response);	
							$("#imgurl_{$file_list.id}").attr("value",response);						
							
						}
						
					}
										  
					window.clearInterval(interval);
								
					this.enable();
					
					if(response == "success")
					alert('上传成功');              
				}
			});
		});
		</script>
 </volist>
      <form action="__APP__/Research/Detail/Test.html" method="post" enctype="multipart/form-data">
	  <volist name="list" id="list">
	  {$list.id|getFormHTML}
		<a style="float:right;"href="__APP__/Research/Detail/Edit/id/{$id}/input_type/{$list.input_type}/input_id/{$list.id}.html" class="btn btn-primary btn-xs">编辑</a>
		<br>
	  </volist>
	  
		<hr>
	    
	 <!--  <button type="submit" class="btn btn-default" style="width:100%;">提交</button>
		 --> 
</form>
  </div>
</div>
			
			
              </div>
           
          </div>

		  
			  
        </div>
        <!-- end: .tray-center -->

        <!-- begin: .tray-right -->
        <aside class="tray tray-right tray350" data-tray-height="match">
		<form action="__APP__/Research/Detail/Edit.html" method="post">
          <!-- menu quick links -->
			<div class="admin-form">

			<center><h4>修改表单</h4></center>
			<hr class="short">
				<volist name="input_type_list" id="input_type_list">
				<a  style="padding-top:10px;"class="btn btn-{$input_type_list.class}" href="__APP__/Research/Detail/Manage/id/{$id}/input_type/{$input_type_list.value}.html" >{$input_type_list.name}</a>
				</volist>
			<hr class="short">
			<if condition="($input_type eq 1) OR ($input_type eq 2) OR ($input_type eq 6)"> 
			
			
			
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <input type="text" name="name"  class="gui-input" placeholder="请输入标题" value="{$input_id_data.name}" >
                <label for="order-id" class="field-icon">
                  <i class="fa fa-flag"></i>
                </label>
              </label>
            </div>
			
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <textarea placeholder="请输入提示"  name="value"  class="form-control" rows="3">{$input_id_data.value}</textarea>
				<label for="order-id" class="field-icon">
                  <i class="fa fa-circle"></i>
                </label>
              </label>
            </div>
			<elseif condition="($input_type eq 3) OR ($input_type eq 4)"/>
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <input type="text" name="name" class="gui-input" placeholder="请输入标题" value="{$input_id_data.name}" >
                <label for="order-id" class="field-icon">
                  <i class="fa fa-flag"></i>
                </label>
              </label>
            </div>
			
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <textarea placeholder="请输入选项以|为分隔"  name="value"  class="form-control" rows="3">{$input_id_data.value}</textarea>
				<label for="order-id" class="field-icon">
                  <i class="fa fa-circle"></i>
                </label>
              </label>
            </div>
			<elseif condition="$input_type eq 5"/>
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <input type="text" name="name"  class="gui-input" placeholder="请输入标题" value="{$input_id_data.value}">
                <label for="order-id" class="field-icon">
                  <i class="fa fa-flag"></i>
                </label>
              </label>
            </div>
			
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <textarea placeholder="请输入描述"  name="value"  class="form-control" rows="3">{$input_id_data.value}</textarea>
				<label for="order-id" class="field-icon">
                  <i class="fa fa-circle"></i>
                </label>
              </label>
            </div>
			<else /> 
			
			</if>
			
			<div class="section mb15">
              <label for="order-id" class="field prepend-icon">
                <input type="text" name="sort" id="sort" class="gui-input" placeholder="请输入排序（越大越靠前）" value="{$input_id_data.sort}">
                <label for="order-id" class="field-icon">
                  <i class="fa fa-check"></i>
                </label>
              </label>
            </div>
		

   

			
			
            <hr class="short">
				<input type="hidden" value="{$input_id_data.id}" name="id">
				<input type="hidden" value="{$id}" name="form_id">
				<input type="hidden" value="{$input_type}" name="input_type">
            <div class="section">
                <button class="btn btn-default btn-sm ph25" type="submit" style="width:100%;">修改表单</button>
               
            </div>

          </div>
		</form>
        </aside>
        <!-- end: .tray-right -->

   

</block>
<block name="Script">
	
  <!-- FooTable Plugin -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.all.min.js"></script>
   <!-- FooTable Addon -->
  <script src="__ABSOLUTEADMIN__/vendor/plugins/footable/js/footable.filter.min.js"></script>

 <script type="text/javascript">
 
	
		function unSelect(){
				
		  $("input[id='batch']").each(function(){
		   $(this).prop("checked",false);
		  });  
		  
	
		}
		
		function selectAll(){
				
		 $("input[id='batch']").each(function(){
		   $(this).prop("checked",true);
		  });  
		  
		}
		
		function reverse(){
				
		 $("input[id='batch']").each(function(){
			$(this).prop("checked",!this.checked);   
		  
			})
		}
		
			
				
				
			
		
				function status(status){
				
				
						 var id=$('input[id="batch"]:checked').map(function(){return this.value}).get().join();
						
						layer.confirm('你确定要这样做么？', {
						  btn: ['确定','取消'] //按钮
						}, function(){
						  
						  $.ajax({
								type:'POST',
								url:"__APP__/Admin/User/Status.html",
								data:{
									
									"id": id,
									"status": status,
									
								},
								success:function(data){			
										var info = eval(data)
										if (info.errcode == 0) {
										
											layer.msg(info.errmsg);
											setTimeout(window.location.reload(),3000);
											
										}else{
											layer.msg(info.errmsg);
										}
								},
								error:function(){
									layer.msg('系统繁忙,请稍候重试！');
								}
							
							});	 
						  
						}, function(){
						  
						  
						});

					
				
				}
				
				
					$("#gid").change(function(){
						  	var gid = $("#gid").val();
							
							
							var url = '__APP__/Admin/User/Manage.html';
							url = url+'?gid='+gid;
						
							 self.location=url;
							
						
						
					});
					
					
						$("#status").change(function(){
						  	var status = $("#status").val();
							
							
							var url = '__APP__/Admin/User/Manage.html';
							url = url+'?status='+status;
						
							 self.location=url;
							
						
						
					});
					
						
					
  jQuery(document).ready(function() {

 

    // Init FooTable Examples
    $('.footable').footable();


  });
  </script>
</block>